import time
import pgzero.actor
import pgzero.animation
import pgzero.screen
import pygame
import data as Data

WIDTH = Data.WIDTH
HEIGHT = Data.HEIGHT

Actor = pgzero.actor.Actor
screen = pgzero.screen.Screen(pygame.Surface((WIDTH,HEIGHT)))
Animation = pgzero.animation.Animation

# 打字机效果，PgZero 中会出现莫名卡顿，故没有使用
def Typewriter(text, pos, font):
    for i in range(len(text)):
        showText = text[0:i + 1]
        screen.draw.text(showText, pos, font)
        time.sleep(1)

# 返回窗口横轴中心坐标
CentralX = lambda width = WIDTH: width // 2

# 返回窗口纵轴中心坐标
CentralY = lambda height = HEIGHT: height // 2

# 二次封装，返回窗口中心坐标
Central = lambda width = WIDTH, height = HEIGHT: [CentralX(width),CentralY(height)] # => list

def Debug(type:int, body):
    list = ['用户操作(pgzrun)','用户操作(ttk)','当前页面','初始化']
    print(list[type],'',body)